<%@ page import="com.entity.user.User" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.List" %><%-- 用户管理 --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<% response.setHeader("Content-Type", "text/html; charset=UTF-8"); %>
<% request.setCharacterEncoding("UTF-8"); %>
<% response.setCharacterEncoding("UTF-8"); %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!--java代码获取系统上下文路径-->
<% String path=request.getContextPath(); %>
<%--JSTL获取系统上下文路径：--%>
<c:set var="ctx" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
    <script src="${ctx}/js/jquery-3.7.1.js"></script>
    <script src="${ctx}/js/util.js"></script>
    <!-- 图标字体库 -->
    <style>@import url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css');</style>
    <!-- jquery-ui库 -->
    <link rel="stylesheet" href="${ctx}/lib/jquery-ui-1.14.1/jquery-ui.css">
    <script src="${ctx}/lib/jquery-ui-1.14.1/jquery-ui.min.js"></script>
    <!--引入外部样式-->
    <link href="${ctx}/css/admin.css" rel="stylesheet">
    <link href="${ctx}/css/management.css" rel="stylesheet">
    <!--引入外部样式-->
    <link href="${ctx}css/UserCSS.css" rel="stylesheet">
    <!--引入js-->
    <script src="${ctx}js/UserJS.js"></script>
    <!--引入底部样式-->
    <link rel="stylesheet" href="${ctx}/css/bottomPage.css"/>
</head>
<body>
<%
    List<User> listUser=(List<User>) session.getAttribute("listUser");
    if(listUser==null){
        response.sendRedirect(path+"/UserServlet?type=selectAll");
        return;
    }
%>

<!-- 导航栏 -->
<nav id="navigationBar">
    <div class="nav-container">
        <%@ include file="../../pubicPage/AdminHead.jsp"%>
    </div>
</nav>
<!-- MOD搜索和筛选 -->
<section class="search">
    <h1><span class="text-accent">MC</span>用户<span class="text-Warning">信息</span>管理</h1>
    <div class="search-container">
        <h2>查找<span class="text-accent">用户</span></h2>
        <div class="search-form">
            <div class="search-input">
                <input id="search" placeholder="搜索用户名称..." type="text">
                <i class="fa fa-search"></i>
            </div>
            <div class="search-filters">

                <button onclick="searchWarnings()">
                    <i class="fa fa-filter mr-2"></i> 筛选
                </button>
                <button>
                    <i class="fa mr-2">添加新警告</i>
                </button>
            </div>
        </div>
    </div>
</section>
<!-- 用户列表 -->
<section class="mod-list">
    <div class="container">
        <table id="warningTable">
            <thead>
            <tr>
                <th>ID</th>
                <th>头像</th>
                <th>用户名称</th>
                <th>最后上线时间</th>
                <th>注册日期</th>
                <th>用户组</th>
                <th>密码</th>
                <th>操作</th>
            </tr>
            <c:if test="${sessionScope.listUser!=null}">
                <c:forEach var="Usert" items="${sessionScope.listUser}">
                    <tr class="tr">
                        <td>${Usert.id}</td>
                        <td>
                            <img src="${ctx}/${Usert.avatar}" alt="头像" width="50" height="50"/>
                        </td>
                        <td>${Usert.name}</td>
                        <td>${Usert.lastOnlineTime}</td>
                        <td>${Usert.registrationDate}</td>
                        <td>${Usert.userGroupId}</td>
                        <td>${Usert.password}</td>
                        <td><input type="button" value="删除"></td>
                    </tr>
                </c:forEach>
            </c:if>
            </thead>
        </table>
    </div>
</section>
    <!-- 关于我们 -->
    <section class="about" id="about">
        <%@ include file="../../pubicPage/bottomPage.jsp"%>
    </section>
</body>
</html>